import request from '@/utils/request'

// 资金账单开始
export function getFundBills(params) {
  return request({
    url: '/finance/fund/',
    method: 'GET',
    params
  })
}

export function getUserFundBills(params) {
  return request({
    url: '/finance/fund/user_bills/',
    method: 'GET',
    params
  })
}

export function addFundBill(data) {
  return request({
    url: '/finance/fund/',
    method: 'POST',
    data
  })
}

export function updateFundBill(data) {
  return request({
    url: `/finance/fund/${data.id}/`,
    method: 'PATCH',
    data
  })
}

export function delFundBill(data_id) {
  return request({
    url: `/finance/fund/${data_id}/`,
    method: 'DELETE',
  })
}

// 资金账单结束
// 还款记录开始
export function getRepaymentBills(params) {
  return request({
    url: '/finance/repayment/',
    method: 'GET',
    params
  })
}

export function addRepaymentBill(data) {
  return request({
    url: '/finance/repayment/',
    method: 'POST',
    data
  })
}

export function updateRepaymentBill(data) {
  return request({
    url: `/finance/repayment/${data.id}/`,
    method: 'PATCH',
    data
  })
}

export function delRepaymentBill(data_id) {
  return request({
    url: `/finance/repayment/${data_id}/`,
    method: 'DELETE',
  })
}

// 还款记录结束
// 利润表
export function getProfitStats(params) {
  return request({
    url: '/finance/profit_stats/',
    method: 'GET',
    params
  })
}